<?php

class MessageAction extends BaseAction {

	public function index() {
		import("ORG.Util.Page");
		$msg = D("Message");
		$count = $msg->count();
		$Page = new Page($count,5);
		$show = $Page->show();


		$msg_list = $msg->order("cTime desc")->limit($Page->firstRow.','.$Page->listRows)->select();
		$this->assign("msgs", $msg_list);
		$this->assign('pages',$show);
		$this->display("Index:message");
	}

	public function insert() {
		$data = $_POST;
		$data['cTime'] = time();
		$data['ip']=$_SERVER["HTTP_X_FORWARDED_FOR"];
		if(D("Message")->add($data)){
			//			$this->success("修改成功！");
		}else{
			//			$this->error("资料无改变或修改失败！");
		}
		$this->redirect("message/"/*,null, 3, '页面跳转中~'*/);

	}

}
?>